##
# Replication for "Too Young to Run? Voter Evaluations of the Age of Candidates" 
# Political Behavior
# Charles T. McClean and Yoshikuni Ono
##

#################
# Load Packages #
#################

library(tidyverse)
library(stargazer)
library(lfe)
library(broom)

####################
# Read in Datasets #
####################

exp1 <- readRDS("exp1.RDS")
exp2 <- readRDS("exp2.RDS")
cands <- readRDS("cands.RDS")

################################################################
# Figure 1: Candidate Age and Vote Choice (Real-World Results) #
################################################################

mod <- felm(vshare ~ age_group + female + inc | party + mcode + year | 0 | mcode, data = cands)

plot.data <- data.frame(tidy(mod, conf.int = TRUE))
plot.data <- plot.data %>%
  filter(term != "(Intercept)" & term != "female" & term != "inc")
plot.data$term <- factor(plot.data$term, levels = c("age_groupAge 65 and Over", "age_groupAge Under 45"),
                         labels = c("Older Candidate\n(Age 65 and Over)", "Younger Candidate\n(Age 25-44)"))

# Plot
ggplot(data = plot.data, aes(estimate, term)) +
  geom_point(na.rm=T) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 na.rm=T) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(limits=c(-10,5),
                     name = "Percentage Point Change in Vote Share", 
                     breaks=seq(-10,5,5)) +
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"))

# Save
ggsave("fig1.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 2,
       units = "in")

rm(cands, mod, plot.data)

##################################################################
# Figure 2: Candidate Age and Vote Choice (Experimental Results) #
##################################################################

exp1$Age <- factor(exp1$Age, levels = c("Middle-Aged", "Younger", "Older"))
mod = felm(Chosen ~ Age | 0 | 0 | ID, data = exp1)

plot.data <- data.frame(tidy(mod, conf.int = TRUE))
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("AgeOlder", "AgeYounger"),
                         labels = c("Older Candidate", "Younger Candidate"))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

# Plot
ggplot(data = plot.data, aes(estimate, term)) +
  geom_point(na.rm=T) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 na.rm=T) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(limits=c(-60,20),
                     name = "Percentage Point Change in Pr(Voting for Candidate)",
                     breaks=seq(-60,20,20)) +
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"))

# Save
ggsave("fig2.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 2,
       units = "in")

rm(mod, plot.data)

################################################################
# Figure 3: Candidate Age and Vote Choice by Age of Respondent #
################################################################

# Categorize RAge
exp1 <- exp1 %>%
  mutate(voters = case_when(
    RAge < 45 ~ "Younger Voters",
    RAge > 44 & RAge < 65 ~ "Middle-Aged Voters",
    RAge > 64 ~ "Older Voters"
  ))

mod1 = felm(Chosen ~ Age | 0 | 0 | ID, data = exp1, subset = voters == "Younger Voters")
plot1 <- data.frame(tidy(mod1, conf.int = TRUE))
plot1$voters <- "Younger Voters"

mod2 = felm(Chosen ~ Age | 0 | 0 | ID, data = exp1, subset = voters == "Middle-Aged Voters")
plot2 <- data.frame(tidy(mod2, conf.int = TRUE))
plot2$voters <- "Middle-Aged Voters"

mod3 = felm(Chosen ~ Age | 0 | 0 | ID, data = exp1, subset = voters == "Older Voters")
plot3 <- data.frame(tidy(mod3, conf.int = TRUE))
plot3$voters <- "Older Voters"

plot.data <- bind_rows(plot1, plot2, plot3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("AgeOlder", "AgeYounger"),
                         labels = c("Older Candidate", "Younger Candidate"))
plot.data$voters <- factor(plot.data$voters, levels = c("Younger Voters", "Middle-Aged Voters", "Older Voters"),
                           labels=c("Younger Voters\n(18-44)", "Middle-Aged Voters\n(45-64)", "Older Voters\n(65 and Over)"))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

# Plot
ggplot(data = plot.data, aes(estimate, term)) +
  geom_point(na.rm=T) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 na.rm=T) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(limits=c(-67,20),
                     name = "Percentage Point Change in Pr(Voting for Candidate)",
                     breaks=seq(-60,20,20)) +
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm")) +
  facet_wrap(~voters)

# Save
ggsave("fig3.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 2.5,
       units = "in")

rm(mod1, mod2, mod3, plot.data, plot1, plot2, plot3)

#############################################
# Figure 4: Candidate Age and Policy Issues #
#############################################

mod = felm(cbind(education, child, environ, corrupt, foreign,
                 economy, public, budget, crime, elderly,
                 health, all_issue) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2)
plot.data <- data.frame(tidy(mod, conf.int = TRUE))
plot.data$response <- rep(c("education", "child", "environ", "corrupt", "foreign",
                    "economy", "public", "budget", "crime", "elderly",
                    "health", "all_issue"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                          labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("education", "child", "environ", "corrupt",
                                                          "foreign", "economy", "public", "budget",
                                                          "crime", "elderly", "health", "all_issue")),
                          labels = rev(c("Education", "Childcare", "Environment and Climate Change", "Anti-Corruption Measures",
                                         "Foreign Residents and Multiculturalism", "Economy and Employment", "Public Works", "Budget Deficit",
                                         "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)")))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Emphasize Policy Issue)") + 
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  scale_colour_grey() 

# Save
ggsave("fig4.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 8,
       units = "in")

rm(mod, plot.data)

######################################
# Figure 5: Candidate Age and Traits #
######################################

mod = felm(cbind(dominant, reliable, determined, considerate,
                 competent, consensus, experience, longterm, all_traits) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2)
plot.data <- data.frame(tidy(mod, conf.int = TRUE))
plot.data$response <- rep(c("dominant", "reliable", "determined", "considerate", "competent", "consensus",
                            "experience", "longterm", "all_traits"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                         labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("dominant", "reliable", "determined", "considerate", "competent", "consensus",
                                                          "experience", "longterm", "all_traits")),
                          labels = rev(c("Dominant", "Reliable", "Determined", "Considerate", "Competent", "Consensus-Oriented",
                                         "Politically Experienced", "Long-Term Oriented", "Average (All Traits)")))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Have Trait)",
                     limits = c(-30, 10.2)) +
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  scale_colour_grey() 

# Save
ggsave("fig5.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 6,
       units = "in")

rm(mod, plot.data)

############################################
# Figure 6: Candidate Age and Electability #
############################################

mod = felm(win ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2)
plot.data <- data.frame(tidy(mod, conf.int = TRUE))
plot.data$response <- rep(c("win"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                         labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("win")),
                             labels = rev(c("Electability")))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Win Election)", 
                     limits = c(-30, 10)) +
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  scale_colour_grey() 

# Save
ggsave("fig6.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 2.5,
       units = "in")

rm(mod, plot.data)

############ 
# Appendix #
############

#########################################################
# Table A1: Candidate Age and Vote Choice (Candidate 1) #
#########################################################

exp1_m1 <- exp1 %>%
  filter((Age == "Younger" & condition9 %in% c("ym", "yo")) |
           (Age == "Middle-Aged" & condition9 %in% c("my", "mo")) |
            (Age == "Older" & condition9 %in% c("oy", "om")))
exp1_m1$Age <- factor(exp1_m1$Age, levels = c("Middle-Aged", "Younger", "Older"))

m1 <- felm(Chosen ~ Age, data=exp1_m1)
m2 <- felm(Chosen ~ Age, data=exp1_m1, subset=RAge < 45)
m3 <- felm(Chosen ~ Age, data=exp1_m1, subset=RAge > 44 & RAge < 65)
m4 <- felm(Chosen ~ Age, data=exp1_m1, subset=RAge > 64)

stargazer(m1, m2, m3, m4, type="text",
          dep.var.labels = c("DV: Chosen by Respondent"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 1", "Older Candidate 1"),
          title="Candidate Age and Vote Choice (Candidate 1)")

rm(exp1_m1, m1, m2, m3, m4)

#########################################################
# Table A2: Candidate Age and Vote Choice (Candidate 2) #
#########################################################

exp1_m2 <- exp1 %>%
  filter((Age == "Younger" & condition9 %in% c("my", "oy")) |
           (Age == "Middle-Aged" & condition9 %in% c("ym", "om")) |
           (Age == "Older" & condition9 %in% c("yo", "mo")))
exp1_m2$Age <- factor(exp1_m2$Age, levels = c("Middle-Aged", "Younger", "Older"))

m1 <- felm(Chosen ~ Age, data=exp1_m2)
m2 <- felm(Chosen ~ Age, data=exp1_m2, subset=RAge < 45)
m3 <- felm(Chosen ~ Age, data=exp1_m2, subset=RAge > 44 & RAge < 65)
m4 <- felm(Chosen ~ Age, data=exp1_m2, subset=RAge > 64)

stargazer(m1, m2, m3, m4, type="text",
          dep.var.labels = c("DV: Chosen by Respondent"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 2", "Older Candidate 2"),
          title="Candidate Age and Vote Choice (Candidate 2)")

rm(exp1_m2, m1, m2, m3, m4)

################################################################
# Table A3: Candidate Age and Vote Choice (Manipulation Check) #
################################################################

exp1$Age <- factor(exp1$Age, levels = c("Middle-Aged", "Younger", "Older"))

m1 <- felm(Chosen ~ Age | 0 | 0 | ID, data=exp1, subset=mcheck==1)
m2 <- felm(Chosen ~ Age | 0 | 0 | ID, data=exp1, subset=RAge < 45 & mcheck==1)
m3 <- felm(Chosen ~ Age | 0 | 0 | ID, data=exp1, subset=RAge > 44 & RAge < 65 & mcheck==1)
m4 <- felm(Chosen ~ Age | 0 | 0 | ID, data=exp1, subset=RAge > 64 & mcheck==1)
stargazer(m1, m2, m3, m4, type="text",
          dep.var.labels = c("DV: Chosen by Respondent"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate", "Older Candidate"),
          title="Candidate Age and Vote Choice (Manipulation Check)")

rm(m1, m2, m3, m4)

###########################################################
# Table A4: Candidate Age and Policy Issues (Candidate 1) #
###########################################################

m1 <- felm(education ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m2 <- felm(child ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m3 <- felm(environ ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m4 <- felm(corrupt ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m5 <- felm(foreign ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m6 <- felm(economy ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m7 <- felm(public ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m8 <- felm(budget ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m9 <- felm(crime ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m10 <- felm(elderly ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m11 <- felm(health ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m12 <- felm(all_issue ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)

stargazer(m1,m2,m3,m4,m5,m6, type="text",
          dep.var.labels = c("Education", "Childcare", "Climate Change", "Anti-Corruption", "Foreign Residents", "Economy and Employment"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 1", "Older Candidate 1"),
          title="Candidate Age and Policy Issues (Candidate 1)")

stargazer(m7,m8,m9,m10,m11,m12, type="text",
          dep.var.labels = c("Public Works", "Budget Deficit", "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 1", "Older Candidate 1"),
          title="Candidate Age and Policy Issues (Candidate 1)")

rm(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12)

###########################################################
# Table A5: Candidate Age and Policy Issues (Candidate 2) #
###########################################################

m1 <- felm(education ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m2 <- felm(child ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m3 <- felm(environ ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m4 <- felm(corrupt ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m5 <- felm(foreign ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m6 <- felm(economy ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m7 <- felm(public ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m8 <- felm(budget ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m9 <- felm(crime ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m10 <- felm(elderly ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m11 <- felm(health ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m12 <- felm(all_issue ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)

# First Six Issues
stargazer(m1,m2,m3,m4,m5,m6, type="text",
          dep.var.labels = c("Education", "Childcare", "Climate Change", "Anti-Corruption", "Foreign Residents", "Economy and Employment"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 2", "Older Candidate 2"),
          title="Candidate Age and Policy Issues (Candidate 2)")

stargazer(m7,m8,m9,m10,m11,m12, type="text",
          dep.var.labels = c("Public Works", "Budget Deficit", "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 2", "Older Candidate 2"),
          title="Candidate Age and Policy Issues (Candidate 2)")

rm(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12)

##################################################################
# Table A6: Candidate Age and Policy Issues (Manipulation Check) #
##################################################################

m1 <- felm(education ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m2 <- felm(child ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m3 <- felm(environ ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m4 <- felm(corrupt ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m5 <- felm(foreign ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m6 <- felm(economy ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m7 <- felm(public ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m8 <- felm(budget ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m9 <- felm(crime ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m10 <- felm(elderly ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m11 <- felm(health ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m12 <- felm(all_issue ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)

stargazer(m1,m2,m3,m4,m5,m6, type="text",
          dep.var.labels = c("Education", "Childcare", "Climate Change", "Anti-Corruption", "Foreign Residents", "Economy and Employment"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate", "Older Candidate"),
          title="Candidate Age and Policy Issues (Manipulation Check)")

stargazer(m7,m8,m9,m10,m11,m12, type="text",
          dep.var.labels = c("Public Works", "Budget Deficit", "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate", "Older Candidate"),
          title="Candidate Age and Policy Issues (Manipulation Check)")

rm(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12)

####################################################
# Table A7: Candidate Age and Traits (Candidate 1) #
####################################################

m1 <- felm(dominant ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m2 <- felm(reliable ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m3 <- felm(determined ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m4 <- felm(considerate ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m5 <- felm(competent ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m6 <- felm(consensus ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m7 <- felm(experience ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m8 <- felm(longterm ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m9 <- felm(all_traits ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)

stargazer(m1,m2,m3,m4,m5,m6, type="text",
          dep.var.labels = c("Dominant", "Reliable", "Determined", "Considerate", "Competent", "Consensus-Oriented"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 1", "Older Candidate 1"),
          title="Candidate Age and Traits (Candidate 1)")

stargazer(m7,m8,m9, type="text",
          dep.var.labels = c("Experienced", "Long-Term Oriented", "Number of Traits"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 1", "Older Candidate 1"),
          title="Candidate Age and Traits (Candidate 1)")

rm(m1, m2, m3, m4, m5, m6, m7, m8, m9)

####################################################
# Table A8: Candidate Age and Traits (Candidate 2) #
####################################################

m1 <- felm(dominant ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m2 <- felm(reliable ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m3 <- felm(determined ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m4 <- felm(considerate ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m5 <- felm(competent ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m6 <- felm(consensus ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m7 <- felm(experience ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m8 <- felm(longterm ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m9 <- felm(all_traits ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)

stargazer(m1,m2,m3,m4,m5,m6, type="text",
          dep.var.labels = c("Dominant", "Reliable", "Determined", "Considerate", "Competent", "Consensus-Oriented"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 2", "Older Candidate 2"),
          title="Candidate Age and Traits (Candidate 2)")

stargazer(m7,m8,m9, type="text",
          dep.var.labels = c("Experienced", "Long-Term Oriented", "Number of Traits"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 2", "Older Candidate 2"),
          title="Candidate Age and Traits (Candidate 2)")

rm(m1, m2, m3, m4, m5, m6, m7, m8, m9)

###########################################################
# Table A9: Candidate Age and Traits (Manipulation Check) #
###########################################################

m1 <- felm(dominant ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m2 <- felm(reliable ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m3 <- felm(determined ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m4 <- felm(considerate ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m5 <- felm(competent ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m6 <- felm(consensus ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m7 <- felm(experience ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m8 <- felm(longterm ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m9 <- felm(all_traits ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)

stargazer(m1,m2,m3,m4,m5,m6, type="text",
          dep.var.labels = c("Dominant", "Reliable", "Determined", "Considerate", "Competent", "Consensus-Oriented"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate", "Older Candidate"),
          title="Candidate Age and Traits (Manipulation Check)")

stargazer(m7,m8,m9, type="text",
          dep.var.labels = c("Experienced", "Long-Term Oriented", "Number of Traits"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate", "Older Candidate"),
          title="Candidate Age and Traits (Manipulation Check)")

rm(m1, m2, m3, m4, m5, m6, m7, m8, m9)

############################################################################
# Table A10: Candidate Age, Attractiveness, and Electability (Candidate 1) #
############################################################################

m1 <- felm(win ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 1)
m2 <- felm(win ~ m1_1 + m1_3 + attractive | 0 | 0 | ID, data=exp2, subset=model == 1)

stargazer(m1,m2, type="text",
          dep.var.labels = c("DV: Electability"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 1", "Older Candidate 1", "Physically Attractive"),
          title="Candidate Age, Attractiveness, and Electability (Candidate 1)")

rm(m1, m2)

########################################################################
# Table A11: Candidate Age, Attractiveness, and Electability (Candidate 2) #
########################################################################

m1 <- felm(win ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=model == 2)
m2 <- felm(win ~ m1_1 + m1_3 + attractive | 0 | 0 | ID, data=exp2, subset=model == 2)

stargazer(m1,m2, type="text",
          dep.var.labels = c("DV: Electability"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate 2", "Older Candidate 2", "Physically Attractive"),
          title="Candidate Age, Attractiveness, and Electability (Candidate 2)")

rm(m1, m2)

###################################################################################
# Table A12: Candidate Age, Attractiveness, and Electability (Manipulation Check) #
###################################################################################

m1 <- felm(win ~ m1_1 + m1_3 | 0 | 0 | ID, data=exp2, subset=mcheck==1)
m2 <- felm(win ~ m1_1 + m1_3 + attractive | 0 | 0 | ID, data=exp2, subset=mcheck==1)

stargazer(m1,m2, type="text",
          dep.var.labels = c("DV: Electability"),
          omit.stat = c("f", "ser", "adj.rsq"),
          digits=3,
          covariate.labels = c("Younger Candidate", "Older Candidate", "Physically Attractive"),
          title="Candidate Age, Attractiveness, and Electability (Manipulation Check)")

rm(m1, m2)

###########################################
# Figure A1: Example of Candidate Posters #
###########################################

# See Appendix

################################################################
# Figure A2: Candidate Age and Attributes by Age of Respondent #
################################################################

# Add Voter Age
exp2 <- exp2 %>%
  mutate(voters = case_when(
    age < 45 ~ "Younger Voters",
    age > 44 & age < 65 ~ "Middle-Aged Voters",
    age > 64 ~ "Older Voters"
  ))

mod1 = felm(cbind(education, child, environ, corrupt, foreign,
                 economy, public, budget, crime, elderly,
                 health, all_issue, dominant, reliable, determined,
                 considerate, competent, consensus, experience, longterm,
                 all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = voters == "Younger Voters")
plot1 <- data.frame(tidy(mod1, conf.int = TRUE))
plot1$voters <- "Younger Voters"

mod2 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = voters == "Middle-Aged Voters")
plot2 <- data.frame(tidy(mod2, conf.int = TRUE))
plot2$voters <- "Middle-Aged Voters"

mod3 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = voters == "Older Voters")
plot3 <- data.frame(tidy(mod3, conf.int = TRUE))
plot3$voters <- "Older Voters"
plot.data <- bind_rows(plot1, plot2, plot3)

plot.data$response <- rep(c("education", "child", "environ", "corrupt", "foreign",
                            "economy", "public", "budget", "crime", "elderly",
                            "health", "all_issue", "dominant", "reliable", "determined",
                            "considerate", "competent", "consensus", "experience", "longterm",
                            "all_traits", "win"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                         labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("education", "child", "environ", "corrupt",
                                                                "foreign", "economy", "public", "budget",
                                                                "crime", "elderly", "health", "all_issue",
                                                                "dominant", "reliable", "determined", "considerate",
                                                                "competent", "consensus", "experience", "longterm",
                                                                "all_traits", "win")),
                             labels = rev(c("Education", "Childcare", "Climate Change", "Anti-Corruption",
                                            "Foreign Residents", "Economy and Employment", "Public Works", "Budget Deficit",
                                            "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)", "Dominant", "Reliable",
                                            "Determined", "Considerate", "Competent", "Consensus-Oriented", "Experienced", "Long-Term Oriented",
                                            "Average (All Traits)", "Electability")))
plot.data$voters <- factor(plot.data$voters, levels = c("Younger Voters", "Middle-Aged Voters", "Older Voters"),
                           labels=c("Younger Voters\n(18-44)", "Middle-Aged Voters\n(45-64)", "Older Voters\n(65 and Over)"))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Have Attribute)",
                     limits = c(-40,40)) + 
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  facet_wrap(~voters) +
  scale_colour_grey() 

ggsave("figA2.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 9,
       units = "in")

rm(mod1, mod2, mod3, plot.data, plot1, plot2, plot3)

########################################################
# Fig. A3 Candidate Age and Attributes by Voter Gender #
########################################################

# Add Voter Gender
exp2 <- exp2 %>%
  mutate(gender = ifelse(female == 1, "Female Voters", "Male Voters"))

mod1 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = gender == "Female Voters")
plot1 <- data.frame(tidy(mod1, conf.int = TRUE))
plot1$voters <- "Female Voters"

mod2 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = gender == "Male Voters")
plot2 <- data.frame(tidy(mod2, conf.int = TRUE))
plot2$voters <- "Male Voters"

plot.data <- bind_rows(plot1, plot2)

plot.data$response <- rep(c("education", "child", "environ", "corrupt", "foreign",
                            "economy", "public", "budget", "crime", "elderly",
                            "health", "all_issue", "dominant", "reliable", "determined",
                            "considerate", "competent", "consensus", "experience", "longterm",
                            "all_traits", "win"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                         labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("education", "child", "environ", "corrupt",
                                                                "foreign", "economy", "public", "budget",
                                                                "crime", "elderly", "health", "all_issue",
                                                                "dominant", "reliable", "determined", "considerate",
                                                                "competent", "consensus", "experience", "longterm",
                                                                "all_traits", "win")),
                             labels = rev(c("Education", "Childcare", "Climate Change", "Anti-Corruption",
                                            "Foreign Residents", "Economy and Employment", "Public Works", "Budget Deficit",
                                            "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)", "Dominant", "Reliable",
                                            "Determined", "Considerate", "Competent", "Consensus-Oriented", "Experienced", "Long-Term Oriented",
                                            "Average (All Traits)", "Electability")))
plot.data$voters <- factor(plot.data$voters, levels = c("Female Voters", "Male Voters"),
                           labels=c("Female Voters", "Male Voters"))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Have Attribute)",
                     limits = c(-40,40)) + 
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  facet_wrap(~voters) +
  scale_colour_grey() 

ggsave("figA3.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 9,
       units = "in")

rm(mod1, mod2, plot.data, plot1, plot2)

###########################################################
# Fig. A4 Candidate Age and Attributes by Voter Education #
###########################################################

# Add Voter Education
exp2 <- exp2 %>%
  mutate(edulevel = ifelse(college == 1, "College-Educated Voters", "Non-College-Educated Voters"))

mod1 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = edulevel == "College-Educated Voters")
plot1 <- data.frame(tidy(mod1, conf.int = TRUE))
plot1$voters <- "College-Educated Voters"

mod2 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = edulevel == "Non-College-Educated Voters")
plot2 <- data.frame(tidy(mod2, conf.int = TRUE))
plot2$voters <- "Non-College-Educated Voters"

plot.data <- bind_rows(plot1, plot2)

plot.data$response <- rep(c("education", "child", "environ", "corrupt", "foreign",
                            "economy", "public", "budget", "crime", "elderly",
                            "health", "all_issue", "dominant", "reliable", "determined",
                            "considerate", "competent", "consensus", "experience", "longterm",
                            "all_traits", "win"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                         labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("education", "child", "environ", "corrupt",
                                                                "foreign", "economy", "public", "budget",
                                                                "crime", "elderly", "health", "all_issue",
                                                                "dominant", "reliable", "determined", "considerate",
                                                                "competent", "consensus", "experience", "longterm",
                                                                "all_traits", "win")),
                             labels = rev(c("Education", "Childcare", "Climate Change", "Anti-Corruption",
                                            "Foreign Residents", "Economy and Employment", "Public Works", "Budget Deficit",
                                            "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)", "Dominant", "Reliable",
                                            "Determined", "Considerate", "Competent", "Consensus-Oriented", "Experienced", "Long-Term Oriented",
                                            "Average (All Traits)", "Electability")))
plot.data$voters <- factor(plot.data$voters, levels = c("College-Educated Voters", "Non-College-Educated Voters"),
                           labels=c("College-Educated Voters", "Non-College-Educated Voters"))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Have Attribute)",
                     limits = c(-40,40)) + 
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  facet_wrap(~voters) +
  scale_colour_grey() 

ggsave("figA4.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 9,
       units = "in")

rm(mod1, mod2, plot.data, plot1, plot2)

##########################################################
# Fig. A5 Candidate Age and Attributes by Voter Ideology #
##########################################################

# Add Voter Ideology
exp2 <- exp2 %>%
  mutate(idgroup = case_when(
    ideology == "Liberal" ~ "Liberal Voters",
    ideology == "Can't Say" ~ "Moderate Voters",
    ideology == "Conservative" ~ "Conservative Voters"
  ))

mod1 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = idgroup == "Liberal Voters")
plot1 <- data.frame(tidy(mod1, conf.int = TRUE))
plot1$voters <- "Liberal Voters"

mod2 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = idgroup == "Moderate Voters")
plot2 <- data.frame(tidy(mod2, conf.int = TRUE))
plot2$voters <- "Moderate Voters"

mod3 = felm(cbind(education, child, environ, corrupt, foreign,
                  economy, public, budget, crime, elderly,
                  health, all_issue, dominant, reliable, determined,
                  considerate, competent, consensus, experience, longterm,
                  all_traits, win) ~ m1_1 + m1_3 | 0 | 0 | ID, data = exp2, subset = idgroup == "Conservative Voters")
plot3 <- data.frame(tidy(mod3, conf.int = TRUE))
plot3$voters <- "Conservative Voters"
plot.data <- bind_rows(plot1, plot2, plot3)

plot.data$response <- rep(c("education", "child", "environ", "corrupt", "foreign",
                            "economy", "public", "budget", "crime", "elderly",
                            "health", "all_issue", "dominant", "reliable", "determined",
                            "considerate", "competent", "consensus", "experience", "longterm",
                            "all_traits", "win"), each = 3)
plot.data <- plot.data %>%
  filter(term != "(Intercept)")
plot.data$term <- factor(plot.data$term, levels = c("m1_1", "m1_3"),
                         labels = c("Younger Candidate", "Older Candidate"))
plot.data$response <- factor(plot.data$response, levels = rev(c("education", "child", "environ", "corrupt",
                                                                "foreign", "economy", "public", "budget",
                                                                "crime", "elderly", "health", "all_issue",
                                                                "dominant", "reliable", "determined", "considerate",
                                                                "competent", "consensus", "experience", "longterm",
                                                                "all_traits", "win")),
                             labels = rev(c("Education", "Childcare", "Climate Change", "Anti-Corruption",
                                            "Foreign Residents", "Economy and Employment", "Public Works", "Budget Deficit",
                                            "Crime and Safety", "Elderly Care", "Healthcare", "Average (All Issues)", "Dominant", "Reliable",
                                            "Determined", "Considerate", "Competent", "Consensus-Oriented", "Experienced", "Long-Term Oriented",
                                            "Average (All Traits)", "Electability")))
plot.data$voters <- factor(plot.data$voters, levels = c("Liberal Voters", "Moderate Voters", "Conservative Voters"),
                           labels=c("Liberal Voters", "Moderate Voters", "Conservative Voters"))

# Multiply by 100
plot.data$estimate <- plot.data$estimate * 100
plot.data$conf.low <- plot.data$conf.low * 100
plot.data$conf.high <- plot.data$conf.high * 100

ggplot(data = plot.data, aes(estimate, response, color=term)) +
  geom_point(position=position_dodge(0.4)) +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high),
                 height = 0,
                 position=position_dodge(0.4)) +
  geom_vline(xintercept = 0) +
  scale_x_continuous(name = "Percentage Point Change in Pr(Saying Candidate Is Likely to Have Attribute)",
                     limits = c(-40,40)) + 
  scale_y_discrete(name = "") +
  theme_bw() +
  theme(axis.title.y = element_blank(),
        axis.title.x = element_text(size=10),
        axis.text.y = element_text(size = 10),
        axis.text.x = element_text(size = 10),
        legend.text = element_text(size = 10),
        strip.text = element_text(size=10),
        panel.spacing = unit(1, "lines"),
        plot.margin = unit(c(0.5,0.5,0.5,0.5), "cm"),
        legend.position = "bottom",
        legend.title = element_blank()) +
  facet_wrap(~voters) +
  scale_colour_grey() 

ggsave("figA5.pdf",
       plot = last_plot(),
       device = "pdf",
       width = 8,
       height = 9,
       units = "in")

rm(mod1, mod2, mod3, plot.data, plot1, plot2, plot3)
